﻿Imports System.Data.OleDb
Imports System.IO
Public Class Orders

    Private Sub Orders_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim databaseProvider As DatabaseProvider = databaseProvider.Instance()
        OrderGridView.DataSource = databaseProvider.GetAllOrders()
        OrdersToolStripMenuItem1.Enabled = False
    End Sub

    Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Application.Exit()
    End Sub

    Private Sub ChooseLanguageToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ChooseLanguageToolStripMenuItem.Click
        Language.Show()
        Me.Close()
    End Sub

    Private Sub AdminToolsToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles AdminToolsToolStripMenuItem.Click
        Start.Show()
        Me.Close()
    End Sub

    Private Sub ProductsToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles ProductsToolStripMenuItem1.Click
        Product.Show()
        Me.Close()
    End Sub

    Private Sub StaffMembersToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles StaffMembersToolStripMenuItem1.Click
        Employee.Show()
        Me.Close()
    End Sub

    Private Sub CustomersToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles CustomersToolStripMenuItem1.Click
        Customer.Show()
        Me.Close()
    End Sub

    Private Sub SalesToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles SalesToolStripMenuItem1.Click
        Sales.Show()
        Me.Close()
    End Sub

    Private Function FindOrderID() As BindingSource
        Dim databaseProvider As DatabaseProvider = databaseProvider.Instance()
        Return databaseProvider.FindOrder(TxtSearchOrder.Text)
    End Function

    Private Sub TxtSearchOrder_TextChanged(sender As System.Object, e As System.EventArgs) Handles TxtSearchOrder.TextChanged
        OrderGridView.DataSource = FindOrderID()
    End Sub
End Class